package com.taomeng.service.impl;

import com.taomeng.dao.DepartmentDao;
import com.taomeng.entity.Department;
import com.taomeng.entity.PageBean;
import com.taomeng.service.DepartmentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

@Slf4j
@Service
public class DepartmentServiceImpl implements DepartmentService {

    @Autowired
    private DepartmentDao departmentDao;


    @Override
    public List<Map<String, Object>> findAll() {

        return departmentDao.findAll();
    }

    @Override
    public PageBean<Department> findByPage(Integer page, Integer limit) {
        return departmentDao.findByPage(page, limit);
    }

    @Override
    public PageBean<Department> findByPage(Integer page, Integer limit, String key) {
        return departmentDao.findByPage(page, limit, key);
    }

    @Override
    public boolean addDepartment(Department department) {
        return departmentDao.addDepartment(department) > 0;
    }

    @Override
    public boolean delDepartmentById(int id) {
        return departmentDao.delDepartmentById(id) > 0;
    }

    @Override
    public boolean updateDepartment(Department department) {
        return departmentDao.updateDepartment(department) > 0;
    }

    @Override
    public boolean delBatchAll(String ids) {
        return departmentDao.delBatchAll(ids);
    }


}
